import Cookies from 'js-cookie'

const TokenKey = 'NETHALL-MZW'

const UserInforKey = 'NETHALL-MZW-USERINFO'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

// 缓存账号信息
export function getUserInfo() {
  return JSON.parse(localStorage.getItem(UserInforKey)) || {}
}

export function setUserInfo(UserInfo) {
  return localStorage.setItem(UserInforKey, JSON.stringify(UserInfo))
}

export function removeUserInfo() {
  return localStorage.removeItem(UserInforKey)
}
